package com.yb.xczx.cloud.auth.generator;

import com.yb.core.model.XczxLoginUser;

import java.util.List;

public  class XczxDelegateCodeGenerator implements XczxCodeGenerator {
    List<XczxCodeGenerator> xczxCodeGenerators;

    public XczxDelegateCodeGenerator(List<XczxCodeGenerator> xczxCodeGenerators){
        this.xczxCodeGenerators=xczxCodeGenerators;
    }

    public boolean support(String loginType){
            return true;
    }
    public String generate(XczxLoginUser xczxLoginUser){

        for (XczxCodeGenerator xczxCodeGenerator : xczxCodeGenerators) {
            if(xczxCodeGenerator.support(xczxLoginUser.getLoginType())){
                return xczxCodeGenerator.generate(xczxLoginUser);
            }
        }
        return "";
    }
}
